<style>
.layui-table-cell {
  height: auto;
  line-height: auto;
  padding: 0 15px;
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}
</style>
<div class="layui-card">
  <div class="layui-card-body">
    <div class="layui-row layui-form" id="form">
        <div class="layui-col-lg1">
            <input type="text" id="min_time" name="min_time" placeholder="最小时间" class="layui-input">
        </div>
        <div class="layui-col-lg1">
            <input type="text" id="max_time" name="max_time" placeholder="最大时间" class="layui-input">
        </div>
        <div class="layui-col-lg1">
            <select lay-filter="com_quicktime">
                <option value="0">快捷时间</option>
                <option value="1">最近1天</option>
                <option value="2">最近2天</option>
                <option value="3">最近3天</option>
                <option value="4">最近4天</option>
                <option value="5">最近5天</option>
                <option value="6">最近6天</option>
                <option value="7">最近7天</option>
                <option value="8">最近8天</option>
                <option value="9">最近9天</option>
                <option value="10">最近10天</option>
                <option value="20">最近20天</option>
                <option value="30">最近30天</option>
                <option value="60">最近60天</option>
                <option value="90">最近90天</option>
                <option value="365">最近365天</option>
            </select>
        </div>
    <div class="layui-col-lg2">
      <input type="text" name="sh_keyword" placeholder="请输入收货人:姓名/电话/地址" autocomplete="off" class="layui-input">
    </div>
      <div class="layui-col-lg2">
        <input type="text" name="title" placeholder="请输入产品名称" autocomplete="off" class="layui-input">
      </div>
      <div class="layui-col-lg1">
        <select name="pay_status">
               <option value="">状态</option>
             <option value="未选定">未选定</option>
             <option value="已选定">已选定</option>
             <option value="已付款">已付款</option>
             <option value="已发货">已发货</option>
             <option value="已收货">已收货</option>
             <option value="已评价">已评价</option>
             <option value="已退货">已退货</option>
           </select>
      </div>
      <div class="layui-col-lg2">
        <button class="layui-btn layui-btn-normal" onclick="search()">搜索</button>
      </div>
    </div>

    <div class="layui-row">
      <table class="layui-hide" lay-filter="table" id="table"></table>
    </div>
  </div>
</div>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">发货</a>
</script>
<script>
  layui.use(['table', 'form'], function() {
    var form = layui.form;
    var table = layui.table;
    var $ = layui.$;
    //var larry = layui.larry;
    form.render('select');
    search = function(is_down=0) {
      var url = "/buycar/lists";
      var data = $("#form").find("[name]");
      var where = {is_down:is_down};
      data.each(function(i, e) {
        where[$(e).attr('name')] = $(e).val();
      });
      table.render({
        elem: '#table',
        url: url,
        where: where,
        method: 'post',
        cellMinWidth: 100,
        page: true,
        cols: [
          [
            {type:'checkbox'},
            {
              field: 'id',
              title: 'ID',
              width: 80,
              sort: true,
            }, {
              field: 'khname',
              title: '用户名',
            },{
              field: 'goodsName',
              title: '商品名称',
            }, {
              field: 'goodsSkuName',
              title: '规格',
              width: 100
            },{
              field: 'buyNumber',
              title: '数量',
              width: 100
            },{
              field: 'buyPrice',
              title: '价格',
              width: 100
            },{
              field: 'addressName',
              title: '收货人姓名'
            },{
              field: 'addressTel',
              title: '收货人电话'
            },{
              field: 'addressMx',
              title: '收货人地址'
            },{
              field: 'workFlow',
              title: '状态',
              width: 80
            }, {
              field: 'payOutId',
              title: '支付单号',
            }, {
              field: 'payTime',
              title: '支付时间',
            }, {
                field: 'expressNum',
                title: '物流单号',
            }, {
              field: 'expressName',
              title: '物流名称',
            }, {
              field: 'text',
              title: '备注',
            }, {
                field: 'time',
                title: '时间',
                width: 120
            },{
              field: 'action',
              title: '操作',
              width: 80,
              align: 'center',
              toolbar: '#barDemo',

            }
          ]
        ],
        done:function(res, curr, count){
            _action(res);
        }
      });
    };
    search();
    //监听工具条
    table.on('tool(table)', function(obj) {
      var data = obj.data;
      if(obj.event === 'edit'){
          layer.open({
            title: '发货',
            type: 2,
            area: ['50%', '50%'],
            content: '/buycar/edit?order_no=' + data.id
          });

        }
    });
  });
</script>
